Completed
Push — master ( 6a420e...d20b5e )
by Mathieu
18s queued 14s
created

File   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 39
dl 0
loc 45
rs 10
c 0
b 0
f 0

5 Functions

Rating   Name   Duplication   Size   Complexity  
A getName 0 3 1
A getSize 0 3 1
A getId 0 3 1
A getMimeType 0 3 1
A getOriginalName 0 6 1
1
import {Entity, Column, PrimaryGeneratedColumn} from 'typeorm';
2
3
@Entity()
4
export class File {
5
  @PrimaryGeneratedColumn('uuid')
6
  private id: string;
7
8
  @Column({type: 'varchar', nullable: false})
9
  private name: string;
10
11
  @Column({type: 'integer', nullable: false})
12
  private size: number;
13
14
  @Column({type: 'varchar', nullable: false})
15
  private mimeType: string;
16
17
  @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'})
18
  private uploadedAt: Date;
19
20
  constructor(name: string, size: number, mimeType: string) {
21
    this.name = name;
22
    this.size = size;
23
    this.mimeType = mimeType;
24
  }
25
26
  public getId(): string {
27
    return this.id;
28
  }
29
30
  public getName(): string {
31
    return this.name;
32
  }
33
34
  public getSize(): number {
35
    return this.size;
36
  }
37
38
  public getMimeType(): string {
39
    return this.mimeType;
40
  }
41
42
  public getOriginalName(): string {
43
    return this.name
44
      .split('_')
45
      .splice(1)
46
      .join('_');
47
  }
48
}
49